home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / amos / eaissu3b.lha / Source_Code / AK_IFF_Fonts_3.AMOS / AK_IFF_Fonts_3.amosSourceCode next >
AMOS Source Code  |  1995-12-30  |  3KB  |  94 lines

  1. ' IFF Font tutorial - Written by Andrew "Mushroom" Kellett 
  2. '
  3. ' Example 3 - Font 09 of 56 possible fonts.
  4. '
  5. ' This font is a clear example of a proportional font, a font that 
  6. ' uses the same width for each of the available characters.
  7. '
  8. ' Demonstrates the _CEN_NINE and _DRAW_NINE routines.
  9. '
  10. Dim TEMPA(10) : Dim TEMPB(10)
  11. Dim NINEX(49) : Dim NINEY(49) : Dim NINEXX(49) : Dim NINEYY(49) : Dim NINES(49)
  12.  
  13. Global NINEX(),NINEY(),NINEXX(),NINEYY(),NINES(),TEMPA(),TEMPB(),POSX,POSY,TEX$
  14. Global _SCREEN,TEMP2,SC$
  15.  
  16. Proc _INSTALL_NINE : Rem Prepare font data
  17.  
  18. Procedure _INSTALL_NINE
  19.    FIRST:
  20.    Data 0,31,31,62,64,95,96,127,128,159,160,191,192,223,224,255,256,287,288,319
  21.    Restore FIRST
  22.    For N=1 To 10 : Read TEMPA(N),TEMPB(N) : Next N
  23.    DAT:
  24.    Data 0,32,33,65,66,98,99,131
  25.    Restore DAT
  26.    PNUM=1
  27.    For N=1 To 4 : Read BYTEA,BYTEB
  28.       For G=1 To 10
  29.          NINEX(PNUM)=TEMPA(G) : NINEY(PNUM)=BYTEA
  30.          NINEXX(PNUM)=TEMPB(G) : NINEYY(PNUM)=BYTEB
  31.          NINES(PNUM)=32
  32.          Inc PNUM
  33.       Next G
  34.    Next N
  35.    ' Extra pieces 
  36.    FDAT:
  37.    Data 0,136,11,168,12,14,136,31,146,18,34,135,65,168,32,67,143,87,168,21
  38.    Data 89,135,96,147,8,99,135,120,168,22,124,135,145,168,22,148,136,168
  39.    Data 156,21,171,135,178,168,8,182,135,194,168,13,196,136,208,161,13
  40.    Data 211,136,223,169,13,226,136,246,160,21
  41.    Restore FDAT
  42.    For N=37 To 49
  43.       Read NINEX(N),NINEY(N),NINEXX(N),NINEYY(N),NINES(N)
  44.    Next N
  45. End Proc
  46.  
  47. Procedure _DRAW_NINE
  48.    J$="0123456789abcdefghijklmnopqrstuvwxyz!"+Chr$(34)+"?+'()-._:;="
  49.    For N=1 To Len(TEX$) : I$=Mid$(TEX$,N,1)
  50.       If I$=" "
  51.          AMO=20
  52.          Goto NXT
  53.       End If 
  54.       NUM=Instr(J$,Lower$(I$))
  55.       Screen Copy 2,NINEX(NUM),NINEY(NUM),NINEXX(NUM),NINEYY(NUM) To _SCREEN,POSX,POSY
  56.       AMO=NINES(NUM)
  57.       NXT:
  58.       Add POSX,AMO
  59.    Next N
  60. End Proc
  61.  
  62. Procedure _CEN_NINE
  63.    J$="0123456789abcdefghijklmnopqrstuvwxyz!"+Chr$(34)+"?+'()-._:;="
  64.    For N=1 To Len(TEX$) : I$=Mid$(TEX$,N,1)
  65.       If I$=" " : Add AMO,20 : Goto NXT : End If 
  66.       NUM=Instr(J$,Lower$(I$))
  67.       Add AMO,NINES(NUM)
  68.       NXT:
  69.    Next N
  70.    POSX=(320-AMO)/2 : Proc _DRAW_NINE
  71. End Proc
  72.  
  73. Screen Open 0,320,200,32,Lowres
  74. Flash Off : Curs Off : Hide On 
  75. Paper 0 : Cls 
  76.  
  77. Unpack 4 To 2 : Screen Hide 2 : Rem Unpack and hide font 
  78.  
  79. Screen To Front 0 : Screen Show 0
  80. Screen 0 : Get Palette 2
  81.  
  82. ' The system is EXTREMELY simple to use........
  83.  
  84. _SCREEN=0 : Rem Set the current screen.
  85.  
  86. TEX$="How to" : POSY=45 : Proc _CEN_NINE
  87. TEX$="centre" : Add POSY,35 : Proc _CEN_NINE
  88. TEX$="an IFF" : Add POSY,35 : Proc _CEN_NINE
  89. TEX$="font !" : Add POSY,35 : Proc _CEN_NINE
  90.  
  91. Repeat : Until Mouse Click
  92. Edit 
  93.  
  94. ' See, what did I tell ya !!